package androidx.appcompat.app;

import android.app.Activity;
import android.app.Dialog;
import android.app.UiModeManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.ActionMode;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.LayoutInflater;
import android.view.LayoutInflater.Factory2;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;
import android.view.ViewParent;
import android.view.Window;
import android.view.Window.Callback;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.view.menu.ListMenuPresenter;
import androidx.appcompat.widget.ActionBarContextView;
import androidx.appcompat.widget.ContentFrameLayout;
import androidx.appcompat.widget.ViewStubCompat;
import androidx.core.view.ViewCompat;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import java.lang.Thread.UncaughtExceptionHandler;
import java.util.List;
import o.ae;
import o.ag;
import o.ah$i;
import o.ah$j;
import o.ah.f;
import o.ah.g;
import o.aj;
import o.ak;
import o.al;
import o.am;
import o.ar;
import o.aw;
import o.ax;
import o.ay;
import o.az;
import o.bc;
import o.bd;
import o.bo;
import o.bx;
import o.cj;
import o.co;
import o.cw;
import o.dd;
import o.de;
import o.fg;
import o.hh;
import o.LayoutInflaterCompatHC;
import o.hx;
import o.ic;
import o.id;
import o.ij;
import o.iw;
import org.xmlpull.v1.XmlPullParser;

class AppCompatDelegateImpl extends AppCompatDelegate implements o.bd.e, Factory2 {
    private static final int[] ʼॱ = new int[]{16842836};
    private static final boolean ʿ = (VERSION.SDK_INT < 21);
    private static boolean ˈ = true;
    PopupWindow ʻ;
    boolean ʻॱ;
    ActionBar ʼ;
    MenuInflater ʽ;
    private cj ʽॱ;
    private CharSequence ʾ;
    private boolean ˉ;
    final Callback ˊ;
    private j ˊˊ;
    private boolean ˊˋ = true;
    boolean ˊॱ;
    private ViewGroup ˊᐝ;
    final Window ˋ;
    private d ˋˊ;
    private boolean ˋˋ;
    Runnable ˋॱ;
    private boolean ˋᐝ;
    private TextView ˌ;
    private boolean ˍ;
    final Callback ˎ;
    private View ˎˎ;
    private boolean ˎˏ;
    final Context ˏ;
    private PanelFeatureState ˏˎ;
    private boolean ˏˏ;
    boolean ˏॱ;
    private PanelFeatureState[] ˑ;
    ic ͺ = null;
    private int ͺॱ = -100;
    private Rect ـ;
    final ae ॱ;
    private Rect ॱʻ;
    private e ॱʼ;
    private boolean ॱʽ;
    boolean ॱˊ;
    boolean ॱˋ;
    boolean ॱˎ;
    private final Runnable ॱͺ = new Runnable(this) {
        final /* synthetic */ AppCompatDelegateImpl ˎ;

        {
            this.ˎ = r1;
        }

        public void run() {
            if ((this.ˎ.ᐝॱ & 1) != 0) {
                this.ˎ.ʽ(0);
            }
            if ((this.ˎ.ᐝॱ & 4096) != 0) {
                this.ˎ.ʽ(108);
            }
            this.ˎ.ॱˋ = false;
            this.ˎ.ᐝॱ = 0;
        }
    };
    ActionBarContextView ॱॱ;
    boolean ॱᐝ;
    aw ᐝ;
    int ᐝॱ;
    private AppCompatViewInflater ᐝᐝ;

    protected static final class PanelFeatureState {
        View ʻ;
        public boolean ʻॱ;
        View ʼ;
        bd ʽ;
        int ˊ;
        boolean ˊॱ;
        int ˋ;
        ListMenuPresenter ˋॱ;
        int ˎ;
        int ˏ;
        Context ˏॱ;
        boolean ͺ;
        int ॱ;
        boolean ॱˊ;
        boolean ॱˋ = false;
        boolean ॱˎ;
        ViewGroup ॱॱ;
        Bundle ॱᐝ;
        int ᐝ;

        static class SavedState implements Parcelable {
            public static final Creator<SavedState> CREATOR = new ClassLoaderCreator<SavedState>() {
                public /* synthetic */ Object createFromParcel(Parcel parcel) {
                    return ˏ(parcel);
                }

                public /* synthetic */ Object createFromParcel(Parcel parcel, ClassLoader classLoader) {
                    return ˊ(parcel, classLoader);
                }

                public /* synthetic */ Object[] newArray(int i) {
                    return ˏ(i);
                }

                public SavedState ˊ(Parcel parcel, ClassLoader classLoader) {
                    return SavedState.ˏ(parcel, classLoader);
                }

                public SavedState ˏ(Parcel parcel) {
                    return SavedState.ˏ(parcel, null);
                }

                public SavedState[] ˏ(int i) {
                    return new SavedState[i];
                }
            };
            Bundle ˎ;
            int ˏ;
            boolean ॱ;

            SavedState() {
            }

            public int describeContents() {
                return 0;
            }

            public void writeToParcel(Parcel parcel, int i) {
                parcel.writeInt(this.ˏ);
                parcel.writeInt(this.ॱ ? 1 : 0);
                if (this.ॱ) {
                    parcel.writeBundle(this.ˎ);
                }
            }

            static SavedState ˏ(Parcel parcel, ClassLoader classLoader) {
                boolean z = true;
                SavedState savedState = new SavedState();
                savedState.ˏ = parcel.readInt();
                if (parcel.readInt() != 1) {
                    z = false;
                }
                savedState.ॱ = z;
                if (savedState.ॱ) {
                    savedState.ˎ = parcel.readBundle(classLoader);
                }
                return savedState;
            }
        }

        PanelFeatureState(int i) {
            this.ˏ = i;
        }

        public boolean ˎ() {
            if (this.ʻ == null) {
                return false;
            }
            if (this.ʼ != null || this.ˋॱ.ˊ().getCount() > 0) {
                return true;
            }
            return false;
        }

        void ˎ(Context context) {
            TypedValue typedValue = new TypedValue();
            Theme newTheme = context.getResources().newTheme();
            newTheme.setTo(context.getTheme());
            newTheme.resolveAttribute(o.ah.c.ˏ, typedValue, true);
            if (typedValue.resourceId != 0) {
                newTheme.applyStyle(typedValue.resourceId, true);
            }
            newTheme.resolveAttribute(o.ah.c.ˌ, typedValue, true);
            if (typedValue.resourceId != 0) {
                newTheme.applyStyle(typedValue.resourceId, true);
            } else {
                newTheme.applyStyle(f.ˏ, true);
            }
            Context axVar = new ax(context, 0);
            axVar.getTheme().setTo(newTheme);
            this.ˏॱ = axVar;
            TypedArray obtainStyledAttributes = axVar.obtainStyledAttributes(g.ˑॱ);
            this.ˎ = obtainStyledAttributes.getResourceId(g.ॱˑ, 0);
            this.ᐝ = obtainStyledAttributes.getResourceId(g.ߴ, 0);
            obtainStyledAttributes.recycle();
        }

        void ॱ(bd bdVar) {
            if (bdVar != this.ʽ) {
                if (this.ʽ != null) {
                    this.ʽ.ˏ(this.ˋॱ);
                }
                this.ʽ = bdVar;
                if (bdVar != null && this.ˋॱ != null) {
                    bdVar.ˊ(this.ˋॱ);
                }
            }
        }

        bo ˏ(o.bn.d dVar) {
            if (this.ʽ == null) {
                return null;
            }
            if (this.ˋॱ == null) {
                this.ˋॱ = new ListMenuPresenter(this.ˏॱ, ah$j.ˊॱ);
                this.ˋॱ.ˎ(dVar);
                this.ʽ.ˊ(this.ˋॱ);
            }
            return this.ˋॱ.ˎ(this.ॱॱ);
        }
    }

    class a extends bc {
        final /* synthetic */ AppCompatDelegateImpl ˋ;

        a(AppCompatDelegateImpl appCompatDelegateImpl, Callback callback) {
            this.ˋ = appCompatDelegateImpl;
            super(callback);
        }

        public boolean dispatchKeyEvent(KeyEvent keyEvent) {
            return this.ˋ.ˊ(keyEvent) || super.dispatchKeyEvent(keyEvent);
        }

        public boolean dispatchKeyShortcutEvent(KeyEvent keyEvent) {
            return super.dispatchKeyShortcutEvent(keyEvent) || this.ˋ.ˎ(keyEvent.getKeyCode(), keyEvent);
        }

        public boolean onCreatePanelMenu(int i, Menu menu) {
            if (i != 0 || (menu instanceof bd)) {
                return super.onCreatePanelMenu(i, menu);
            }
            return false;
        }

        public void onContentChanged() {
        }

        public boolean onPreparePanel(int i, View view, Menu menu) {
            bd bdVar;
            if (menu instanceof bd) {
                bdVar = (bd) menu;
            } else {
                bdVar = null;
            }
            if (i == 0 && bdVar == null) {
                return false;
            }
            if (bdVar != null) {
                bdVar.ˊ(true);
            }
            boolean onPreparePanel = super.onPreparePanel(i, view, menu);
            if (bdVar == null) {
                return onPreparePanel;
            }
            bdVar.ˊ(false);
            return onPreparePanel;
        }

        public boolean onMenuOpened(int i, Menu menu) {
            super.onMenuOpened(i, menu);
            this.ˋ.ॱ(i);
            return true;
        }

        public void onPanelClosed(int i, Menu menu) {
            super.onPanelClosed(i, menu);
            this.ˋ.ˏ(i);
        }

        public ActionMode onWindowStartingActionMode(ActionMode.Callback callback) {
            if (VERSION.SDK_INT >= 23) {
                return null;
            }
            if (this.ˋ.ʻॱ()) {
                return ॱ(callback);
            }
            return super.onWindowStartingActionMode(callback);
        }

        final ActionMode ॱ(ActionMode.Callback callback) {
            o.aw.c aVar = new o.ba.a(this.ˋ.ˏ, callback);
            aw ॱ = this.ˋ.ॱ(aVar);
            if (ॱ != null) {
                return aVar.ˊ(ॱ);
            }
            return null;
        }

        @RequiresApi(23)
        public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int i) {
            if (this.ˋ.ʻॱ()) {
                switch (i) {
                    case 0:
                        return ॱ(callback);
                }
            }
            return super.onWindowStartingActionMode(callback, i);
        }

        @RequiresApi(24)
        public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> list, Menu menu, int i) {
            PanelFeatureState ˊ = this.ˋ.ˊ(0, true);
            if (ˊ == null || ˊ.ʽ == null) {
                super.onProvideKeyboardShortcuts(list, menu, i);
            } else {
                super.onProvideKeyboardShortcuts(list, ˊ.ʽ, i);
            }
        }
    }

    class b extends ContentFrameLayout {
        final /* synthetic */ AppCompatDelegateImpl ˎ;

        public b(AppCompatDelegateImpl appCompatDelegateImpl, Context context) {
            this.ˎ = appCompatDelegateImpl;
            super(context);
        }

        public boolean dispatchKeyEvent(KeyEvent keyEvent) {
            return this.ˎ.ˊ(keyEvent) || super.dispatchKeyEvent(keyEvent);
        }

        public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
            if (motionEvent.getAction() != 0 || !ˋ((int) motionEvent.getX(), (int) motionEvent.getY())) {
                return super.onInterceptTouchEvent(motionEvent);
            }
            this.ˎ.ʼ(0);
            return true;
        }

        public void setBackgroundResource(int i) {
            setBackgroundDrawable(ar.ˋ(getContext(), i));
        }

        private boolean ˋ(int i, int i2) {
            return i < -5 || i2 < -5 || i > getWidth() + 5 || i2 > getHeight() + 5;
        }
    }

    class c implements o.aw.c {
        final /* synthetic */ AppCompatDelegateImpl ˏ;
        private o.aw.c ॱ;

        public c(AppCompatDelegateImpl appCompatDelegateImpl, o.aw.c cVar) {
            this.ˏ = appCompatDelegateImpl;
            this.ॱ = cVar;
        }

        public boolean ˋ(aw awVar, Menu menu) {
            return this.ॱ.ˋ(awVar, menu);
        }

        public boolean ˎ(aw awVar, Menu menu) {
            return this.ॱ.ˎ(awVar, menu);
        }

        public boolean ˎ(aw awVar, MenuItem menuItem) {
            return this.ॱ.ˎ(awVar, menuItem);
        }

        public void ˎ(aw awVar) {
            this.ॱ.ˎ(awVar);
            if (this.ˏ.ʻ != null) {
                this.ˏ.ˋ.getDecorView().removeCallbacks(this.ˏ.ˋॱ);
            }
            if (this.ˏ.ॱॱ != null) {
                this.ˏ.ॱᐝ();
                this.ˏ.ͺ = ViewCompat.ˏॱ(this.ˏ.ॱॱ).ˏ(0.0f);
                this.ˏ.ͺ.ॱ(new id(this) {
                    final /* synthetic */ c ˎ;

                    {
                        this.ˎ = r1;
                    }

                    public void ˎ(View view) {
                        this.ˎ.ˏ.ॱॱ.setVisibility(8);
                        if (this.ˎ.ˏ.ʻ != null) {
                            this.ˎ.ˏ.ʻ.dismiss();
                        } else if (this.ˎ.ˏ.ॱॱ.getParent() instanceof View) {
                            ViewCompat.ᐝॱ((View) this.ˎ.ˏ.ॱॱ.getParent());
                        }
                        this.ˎ.ˏ.ॱॱ.removeAllViews();
                        this.ˎ.ˏ.ͺ.ॱ(null);
                        this.ˎ.ˏ.ͺ = null;
                    }
                });
            }
            if (this.ˏ.ॱ != null) {
                this.ˏ.ॱ.ˎ(this.ˏ.ᐝ);
            }
            this.ˏ.ᐝ = null;
        }
    }

    final class d implements o.bn.d {
        final /* synthetic */ AppCompatDelegateImpl ˋ;

        d(AppCompatDelegateImpl appCompatDelegateImpl) {
            this.ˋ = appCompatDelegateImpl;
        }

        public boolean ˎ(bd bdVar) {
            Callback ˊॱ = this.ˋ.ˊॱ();
            if (ˊॱ != null) {
                ˊॱ.onMenuOpened(108, bdVar);
            }
            return true;
        }

        public void ॱ(bd bdVar, boolean z) {
            this.ˋ.ˊ(bdVar);
        }
    }

    @VisibleForTesting
    final class e {
        final /* synthetic */ AppCompatDelegateImpl ˊ;
        private BroadcastReceiver ˋ;
        private al ˎ;
        private boolean ˏ;
        private IntentFilter ॱ;

        e(AppCompatDelegateImpl appCompatDelegateImpl, @NonNull al alVar) {
            this.ˊ = appCompatDelegateImpl;
            this.ˎ = alVar;
            this.ˏ = alVar.ॱ();
        }

        int ˊ() {
            this.ˏ = this.ˎ.ॱ();
            return this.ˏ ? 2 : 1;
        }

        void ˋ() {
            boolean ॱ = this.ˎ.ॱ();
            if (ॱ != this.ˏ) {
                this.ˏ = ॱ;
                this.ˊ.ᐝ();
            }
        }

        void ˎ() {
            ˏ();
            if (this.ˋ == null) {
                this.ˋ = new BroadcastReceiver(this) {
                    final /* synthetic */ e ˏ;

                    {
                        this.ˏ = r1;
                    }

                    public void onReceive(Context context, Intent intent) {
                        this.ˏ.ˋ();
                    }
                };
            }
            if (this.ॱ == null) {
                this.ॱ = new IntentFilter();
                this.ॱ.addAction("android.intent.action.TIME_SET");
                this.ॱ.addAction("android.intent.action.TIMEZONE_CHANGED");
                this.ॱ.addAction("android.intent.action.TIME_TICK");
            }
            this.ˊ.ˏ.registerReceiver(this.ˋ, this.ॱ);
        }

        void ˏ() {
            if (this.ˋ != null) {
                this.ˊ.ˏ.unregisterReceiver(this.ˋ);
                this.ˋ = null;
            }
        }
    }

    final class j implements o.bn.d {
        final /* synthetic */ AppCompatDelegateImpl ॱ;

        j(AppCompatDelegateImpl appCompatDelegateImpl) {
            this.ॱ = appCompatDelegateImpl;
        }

        public void ॱ(bd bdVar, boolean z) {
            Menu menu;
            bd ॱˋ = bdVar.ॱˋ();
            boolean z2 = ॱˋ != bdVar;
            AppCompatDelegateImpl appCompatDelegateImpl = this.ॱ;
            if (z2) {
                menu = ॱˋ;
            }
            PanelFeatureState ˏ = appCompatDelegateImpl.ˏ(menu);
            if (ˏ == null) {
                return;
            }
            if (z2) {
                this.ॱ.ˋ(ˏ.ˏ, ˏ, ॱˋ);
                this.ॱ.ˊ(ˏ, true);
                return;
            }
            this.ॱ.ˊ(ˏ, z);
        }

        public boolean ˎ(bd bdVar) {
            if (bdVar == null && this.ॱ.ˏॱ) {
                Callback ˊॱ = this.ॱ.ˊॱ();
                if (!(ˊॱ == null || this.ॱ.ॱᐝ)) {
                    ˊॱ.onMenuOpened(108, bdVar);
                }
            }
            return true;
        }
    }

    static {
        if (ʿ && !ˈ) {
            final UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
            Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
                public void uncaughtException(Thread thread, Throwable th) {
                    if (ˏ(th)) {
                        Throwable notFoundException = new NotFoundException(th.getMessage() + ". If the resource you are trying to use is a vector resource, you may be referencing it in an unsupported way. See AppCompatDelegate.setCompatVectorFromResourcesEnabled() for more info.");
                        notFoundException.initCause(th.getCause());
                        notFoundException.setStackTrace(th.getStackTrace());
                        defaultUncaughtExceptionHandler.uncaughtException(thread, notFoundException);
                        return;
                    }
                    defaultUncaughtExceptionHandler.uncaughtException(thread, th);
                }

                private boolean ˏ(Throwable th) {
                    if (!(th instanceof NotFoundException)) {
                        return false;
                    }
                    String message = th.getMessage();
                    if (message == null) {
                        return false;
                    }
                    if (message.contains("drawable") || message.contains("Drawable")) {
                        return true;
                    }
                    return false;
                }
            });
        }
    }

    AppCompatDelegateImpl(Context context, Window window, ae aeVar) {
        this.ˏ = context;
        this.ˋ = window;
        this.ॱ = aeVar;
        this.ˎ = this.ˋ.getCallback();
        if (this.ˎ instanceof a) {
            throw new IllegalStateException("AppCompat has already installed itself into the Window");
        }
        this.ˊ = new a(this, this.ˎ);
        this.ˋ.setCallback(this.ˊ);
        cw ˊ = cw.ˊ(context, null, ʼॱ);
        Drawable ˎ = ˊ.ˎ(0);
        if (ˎ != null) {
            this.ˋ.setBackgroundDrawable(ˎ);
        }
        ˊ.ॱ();
    }

    public void ˎ(Bundle bundle) {
        if (this.ˎ instanceof Activity) {
            String ˏ;
            try {
                ˏ = fg.ˏ((Activity) this.ˎ);
            } catch (IllegalArgumentException e) {
                ˏ = null;
            }
            if (ˏ != null) {
                ActionBar ˋॱ = ˋॱ();
                if (ˋॱ == null) {
                    this.ॱʽ = true;
                } else {
                    ˋॱ.ॱ(true);
                }
            }
        }
        if (bundle != null && this.ͺॱ == -100) {
            this.ͺॱ = bundle.getInt("appcompat:local_night_mode", -100);
        }
    }

    public void ॱ(Bundle bundle) {
        ˈ();
    }

    public ActionBar ˏ() {
        ᐝॱ();
        return this.ʼ;
    }

    final ActionBar ˋॱ() {
        return this.ʼ;
    }

    final Callback ˊॱ() {
        return this.ˋ.getCallback();
    }

    private void ᐝॱ() {
        ˈ();
        if (this.ˏॱ && this.ʼ == null) {
            if (this.ˎ instanceof Activity) {
                this.ʼ = new aj((Activity) this.ˎ, this.ˊॱ);
            } else if (this.ˎ instanceof Dialog) {
                this.ʼ = new aj((Dialog) this.ˎ);
            }
            if (this.ʼ != null) {
                this.ʼ.ॱ(this.ॱʽ);
            }
        }
    }

    final Context ͺ() {
        Context context = null;
        ActionBar ˏ = ˏ();
        if (ˏ != null) {
            context = ˏ.ॱ();
        }
        if (context == null) {
            return this.ˏ;
        }
        return context;
    }

    public MenuInflater ˋ() {
        if (this.ʽ == null) {
            ᐝॱ();
            this.ʽ = new az(this.ʼ != null ? this.ʼ.ॱ() : this.ˏ);
        }
        return this.ʽ;
    }

    @Nullable
    public <T extends View> T ˋ(@IdRes int i) {
        ˈ();
        return this.ˋ.findViewById(i);
    }

    public void ˏ(Configuration configuration) {
        if (this.ˏॱ && this.ˉ) {
            ActionBar ˏ = ˏ();
            if (ˏ != null) {
                ˏ.ˎ(configuration);
            }
        }
        bx.ˋ().ˏ(this.ˏ);
        ᐝ();
    }

    public void ˊ() {
        ᐝ();
    }

    public void ॱ() {
        ActionBar ˏ = ˏ();
        if (ˏ != null) {
            ˏ.ˎ(false);
        }
        if (this.ॱʼ != null) {
            this.ॱʼ.ˏ();
        }
    }

    public void ˎ() {
        ActionBar ˏ = ˏ();
        if (ˏ != null) {
            ˏ.ˎ(true);
        }
    }

    public void ˏ(View view) {
        ˈ();
        ViewGroup viewGroup = (ViewGroup) this.ˊᐝ.findViewById(16908290);
        viewGroup.removeAllViews();
        viewGroup.addView(view);
        this.ˎ.onContentChanged();
    }

    public void ˊ(int i) {
        ˈ();
        ViewGroup viewGroup = (ViewGroup) this.ˊᐝ.findViewById(16908290);
        viewGroup.removeAllViews();
        LayoutInflater.from(this.ˏ).inflate(i, viewGroup);
        this.ˎ.onContentChanged();
    }

    public void ˏ(View view, LayoutParams layoutParams) {
        ˈ();
        ViewGroup viewGroup = (ViewGroup) this.ˊᐝ.findViewById(16908290);
        viewGroup.removeAllViews();
        viewGroup.addView(view, layoutParams);
        this.ˎ.onContentChanged();
    }

    public void ˎ(View view, LayoutParams layoutParams) {
        ˈ();
        ((ViewGroup) this.ˊᐝ.findViewById(16908290)).addView(view, layoutParams);
        this.ˎ.onContentChanged();
    }

    public void ˊ(Bundle bundle) {
        if (this.ͺॱ != -100) {
            bundle.putInt("appcompat:local_night_mode", this.ͺॱ);
        }
    }

    public void ʻ() {
        if (this.ॱˋ) {
            this.ˋ.getDecorView().removeCallbacks(this.ॱͺ);
        }
        this.ॱᐝ = true;
        if (this.ʼ != null) {
            this.ʼ.ʽ();
        }
        if (this.ॱʼ != null) {
            this.ॱʼ.ˏ();
        }
    }

    private void ˈ() {
        if (!this.ˉ) {
            this.ˊᐝ = ʽॱ();
            CharSequence ˏॱ = ˏॱ();
            if (!TextUtils.isEmpty(ˏॱ)) {
                if (this.ʽॱ != null) {
                    this.ʽॱ.setWindowTitle(ˏॱ);
                } else if (ˋॱ() != null) {
                    ˋॱ().ˏ(ˏॱ);
                } else if (this.ˌ != null) {
                    this.ˌ.setText(ˏॱ);
                }
            }
            ʾ();
            ˎ(this.ˊᐝ);
            this.ˉ = true;
            PanelFeatureState ˊ = ˊ(0, false);
            if (!this.ॱᐝ) {
                if (ˊ == null || ˊ.ʽ == null) {
                    ʻ(108);
                }
            }
        }
    }

    private ViewGroup ʽॱ() {
        TypedArray obtainStyledAttributes = this.ˏ.obtainStyledAttributes(g.ˑॱ);
        if (obtainStyledAttributes.hasValue(g.ՙ)) {
            View view;
            if (obtainStyledAttributes.getBoolean(g.ـॱ, false)) {
                ˎ(1);
            } else if (obtainStyledAttributes.getBoolean(g.ՙ, false)) {
                ˎ(108);
            }
            if (obtainStyledAttributes.getBoolean(g.ٴ, false)) {
                ˎ(109);
            }
            if (obtainStyledAttributes.getBoolean(g.י, false)) {
                ˎ(10);
            }
            this.ॱˎ = obtainStyledAttributes.getBoolean(g.ˎͺ, false);
            obtainStyledAttributes.recycle();
            this.ˋ.getDecorView();
            LayoutInflater from = LayoutInflater.from(this.ˏ);
            if (this.ʻॱ) {
                View view2;
                if (this.ॱˊ) {
                    view2 = (ViewGroup) from.inflate(ah$j.ॱˎ, null);
                } else {
                    view2 = (ViewGroup) from.inflate(ah$j.ᐝॱ, null);
                }
                if (VERSION.SDK_INT >= 21) {
                    ViewCompat.ˋ(view2, new hx(this) {
                        final /* synthetic */ AppCompatDelegateImpl ॱ;

                        {
                            this.ॱ = r1;
                        }

                        public ij ˋ(View view, ij ijVar) {
                            int ˎ = ijVar.ˎ();
                            int ॱॱ = this.ॱ.ॱॱ(ˎ);
                            if (ˎ != ॱॱ) {
                                ijVar = ijVar.ˎ(ijVar.ˏ(), ॱॱ, ijVar.ˋ(), ijVar.ˊ());
                            }
                            return ViewCompat.ˊ(view, ijVar);
                        }
                    });
                    view = view2;
                } else {
                    ((co) view2).setOnFitSystemWindowsListener(new o.co.b(this) {
                        final /* synthetic */ AppCompatDelegateImpl ˎ;

                        {
                            this.ˎ = r1;
                        }

                        public void ˊ(Rect rect) {
                            rect.top = this.ˎ.ॱॱ(rect.top);
                        }
                    });
                    view = view2;
                }
            } else if (this.ॱˎ) {
                r0 = (ViewGroup) from.inflate(ah$j.ᐝ, null);
                this.ˊॱ = false;
                this.ˏॱ = false;
                view = r0;
            } else if (this.ˏॱ) {
                Context axVar;
                TypedValue typedValue = new TypedValue();
                this.ˏ.getTheme().resolveAttribute(o.ah.c.ॱॱ, typedValue, true);
                if (typedValue.resourceId != 0) {
                    axVar = new ax(this.ˏ, typedValue.resourceId);
                } else {
                    axVar = this.ˏ;
                }
                r0 = (ViewGroup) LayoutInflater.from(axVar).inflate(ah$j.ʻॱ, null);
                this.ʽॱ = (cj) r0.findViewById(ah$i.ᐝॱ);
                this.ʽॱ.setWindowCallback(ˊॱ());
                if (this.ˊॱ) {
                    this.ʽॱ.ˏ(109);
                }
                if (this.ˍ) {
                    this.ʽॱ.ˏ(2);
                }
                if (this.ˋᐝ) {
                    this.ʽॱ.ˏ(5);
                }
                view = r0;
            } else {
                view = null;
            }
            if (view == null) {
                throw new IllegalArgumentException("AppCompat does not support the current theme features: { windowActionBar: " + this.ˏॱ + ", windowActionBarOverlay: " + this.ˊॱ + ", android:windowIsFloating: " + this.ॱˎ + ", windowActionModeOverlay: " + this.ॱˊ + ", windowNoTitle: " + this.ʻॱ + " }");
            }
            if (this.ʽॱ == null) {
                this.ˌ = (TextView) view.findViewById(ah$i.ـ);
            }
            de.ˏ(view);
            ContentFrameLayout contentFrameLayout = (ContentFrameLayout) view.findViewById(ah$i.ˊ);
            ViewGroup viewGroup = (ViewGroup) this.ˋ.findViewById(16908290);
            if (viewGroup != null) {
                while (viewGroup.getChildCount() > 0) {
                    View childAt = viewGroup.getChildAt(0);
                    viewGroup.removeViewAt(0);
                    contentFrameLayout.addView(childAt);
                }
                viewGroup.setId(-1);
                contentFrameLayout.setId(16908290);
                if (viewGroup instanceof FrameLayout) {
                    ((FrameLayout) viewGroup).setForeground(null);
                }
            }
            this.ˋ.setContentView(view);
            contentFrameLayout.setAttachListener(new androidx.appcompat.widget.ContentFrameLayout.c(this) {
                final /* synthetic */ AppCompatDelegateImpl ˊ;

                {
                    this.ˊ = r1;
                }

                public void ˏ() {
                }

                public void ˋ() {
                    this.ˊ.ॱˋ();
                }
            });
            return view;
        }
        obtainStyledAttributes.recycle();
        throw new IllegalStateException("You need to use a Theme.AppCompat theme (or descendant) with this activity.");
    }

    void ˎ(ViewGroup viewGroup) {
    }

    private void ʾ() {
        ContentFrameLayout contentFrameLayout = (ContentFrameLayout) this.ˊᐝ.findViewById(16908290);
        View decorView = this.ˋ.getDecorView();
        contentFrameLayout.setDecorPadding(decorView.getPaddingLeft(), decorView.getPaddingTop(), decorView.getPaddingRight(), decorView.getPaddingBottom());
        TypedArray obtainStyledAttributes = this.ˏ.obtainStyledAttributes(g.ˑॱ);
        obtainStyledAttributes.getValue(g.ॱʿ, contentFrameLayout.ˊ());
        obtainStyledAttributes.getValue(g.ॱˌ, contentFrameLayout.ˋ());
        if (obtainStyledAttributes.hasValue(g.ߵ)) {
            obtainStyledAttributes.getValue(g.ߵ, contentFrameLayout.ˎ());
        }
        if (obtainStyledAttributes.hasValue(g.ߺ)) {
            obtainStyledAttributes.getValue(g.ߺ, contentFrameLayout.ॱ());
        }
        if (obtainStyledAttributes.hasValue(g.ॱʾ)) {
            obtainStyledAttributes.getValue(g.ॱʾ, contentFrameLayout.ˏ());
        }
        if (obtainStyledAttributes.hasValue(g.ॱˈ)) {
            obtainStyledAttributes.getValue(g.ॱˈ, contentFrameLayout.ʻ());
        }
        obtainStyledAttributes.recycle();
        contentFrameLayout.requestLayout();
    }

    public boolean ˎ(int i) {
        int ˋॱ = ˋॱ(i);
        if (this.ʻॱ && ˋॱ == 108) {
            return false;
        }
        if (this.ˏॱ && ˋॱ == 1) {
            this.ˏॱ = false;
        }
        switch (ˋॱ) {
            case 1:
                ʼॱ();
                this.ʻॱ = true;
                return true;
            case 2:
                ʼॱ();
                this.ˍ = true;
                return true;
            case 5:
                ʼॱ();
                this.ˋᐝ = true;
                return true;
            case 10:
                ʼॱ();
                this.ॱˊ = true;
                return true;
            case 108:
                ʼॱ();
                this.ˏॱ = true;
                return true;
            case 109:
                ʼॱ();
                this.ˊॱ = true;
                return true;
            default:
                return this.ˋ.requestFeature(ˋॱ);
        }
    }

    public final void ˎ(CharSequence charSequence) {
        this.ʾ = charSequence;
        if (this.ʽॱ != null) {
            this.ʽॱ.setWindowTitle(charSequence);
        } else if (ˋॱ() != null) {
            ˋॱ().ˏ(charSequence);
        } else if (this.ˌ != null) {
            this.ˌ.setText(charSequence);
        }
    }

    final CharSequence ˏॱ() {
        if (this.ˎ instanceof Activity) {
            return ((Activity) this.ˎ).getTitle();
        }
        return this.ʾ;
    }

    void ˏ(int i) {
        if (i == 108) {
            ActionBar ˏ = ˏ();
            if (ˏ != null) {
                ˏ.ˋ(false);
            }
        } else if (i == 0) {
            PanelFeatureState ˊ = ˊ(i, true);
            if (ˊ.ͺ) {
                ˊ(ˊ, false);
            }
        }
    }

    void ॱ(int i) {
        if (i == 108) {
            ActionBar ˏ = ˏ();
            if (ˏ != null) {
                ˏ.ˋ(true);
            }
        }
    }

    public boolean ॱ(bd bdVar, MenuItem menuItem) {
        Callback ˊॱ = ˊॱ();
        if (!(ˊॱ == null || this.ॱᐝ)) {
            PanelFeatureState ˏ = ˏ(bdVar.ॱˋ());
            if (ˏ != null) {
                return ˊॱ.onMenuItemSelected(ˏ.ˏ, menuItem);
            }
        }
        return false;
    }

    public void ˎ(bd bdVar) {
        ˋ(bdVar, true);
    }

    public aw ॱ(@NonNull o.aw.c cVar) {
        if (cVar == null) {
            throw new IllegalArgumentException("ActionMode callback can not be null.");
        }
        if (this.ᐝ != null) {
            this.ᐝ.ॱ();
        }
        o.aw.c cVar2 = new c(this, cVar);
        ActionBar ˏ = ˏ();
        if (ˏ != null) {
            this.ᐝ = ˏ.ˎ(cVar2);
            if (!(this.ᐝ == null || this.ॱ == null)) {
                this.ॱ.ˋ(this.ᐝ);
            }
        }
        if (this.ᐝ == null) {
            this.ᐝ = ˏ(cVar2);
        }
        return this.ᐝ;
    }

    public void ॱॱ() {
        ActionBar ˏ = ˏ();
        if (ˏ == null || !ˏ.ˏ()) {
            ʻ(0);
        }
    }

    aw ˏ(@NonNull o.aw.c cVar) {
        aw awVar;
        ॱᐝ();
        if (this.ᐝ != null) {
            this.ᐝ.ॱ();
        }
        if (!(cVar instanceof c)) {
            cVar = new c(this, cVar);
        }
        if (this.ॱ == null || this.ॱᐝ) {
            awVar = null;
        } else {
            try {
                awVar = this.ॱ.ˏ(cVar);
            } catch (AbstractMethodError e) {
                awVar = null;
            }
        }
        if (awVar != null) {
            this.ᐝ = awVar;
        } else {
            if (this.ॱॱ == null) {
                if (this.ॱˎ) {
                    Context axVar;
                    TypedValue typedValue = new TypedValue();
                    Theme theme = this.ˏ.getTheme();
                    theme.resolveAttribute(o.ah.c.ॱॱ, typedValue, true);
                    if (typedValue.resourceId != 0) {
                        Theme newTheme = this.ˏ.getResources().newTheme();
                        newTheme.setTo(theme);
                        newTheme.applyStyle(typedValue.resourceId, true);
                        axVar = new ax(this.ˏ, 0);
                        axVar.getTheme().setTo(newTheme);
                    } else {
                        axVar = this.ˏ;
                    }
                    this.ॱॱ = new ActionBarContextView(axVar);
                    this.ʻ = new PopupWindow(axVar, null, o.ah.c.ʼ);
                    iw.ˎ(this.ʻ, 2);
                    this.ʻ.setContentView(this.ॱॱ);
                    this.ʻ.setWidth(-1);
                    axVar.getTheme().resolveAttribute(o.ah.c.ˋ, typedValue, true);
                    this.ॱॱ.setContentHeight(TypedValue.complexToDimensionPixelSize(typedValue.data, axVar.getResources().getDisplayMetrics()));
                    this.ʻ.setHeight(-2);
                    this.ˋॱ = new Runnable(this) {
                        final /* synthetic */ AppCompatDelegateImpl ˋ;

                        {
                            this.ˋ = r1;
                        }

                        public void run() {
                            this.ˋ.ʻ.showAtLocation(this.ˋ.ॱॱ, 55, 0, 0);
                            this.ˋ.ॱᐝ();
                            if (this.ˋ.ॱˊ()) {
                                this.ˋ.ॱॱ.setAlpha(0.0f);
                                this.ˋ.ͺ = ViewCompat.ˏॱ(this.ˋ.ॱॱ).ˏ(1.0f);
                                this.ˋ.ͺ.ॱ(new id(this) {
                                    final /* synthetic */ AnonymousClass9 ॱ;

                                    {
                                        this.ॱ = r1;
                                    }

                                    public void ˏ(View view) {
                                        this.ॱ.ˋ.ॱॱ.setVisibility(0);
                                    }

                                    public void ˎ(View view) {
                                        this.ॱ.ˋ.ॱॱ.setAlpha(1.0f);
                                        this.ॱ.ˋ.ͺ.ॱ(null);
                                        this.ॱ.ˋ.ͺ = null;
                                    }
                                });
                                return;
                            }
                            this.ˋ.ॱॱ.setAlpha(1.0f);
                            this.ˋ.ॱॱ.setVisibility(0);
                        }
                    };
                } else {
                    ViewStubCompat viewStubCompat = (ViewStubCompat) this.ˊᐝ.findViewById(ah$i.ʼ);
                    if (viewStubCompat != null) {
                        viewStubCompat.setLayoutInflater(LayoutInflater.from(ͺ()));
                        this.ॱॱ = (ActionBarContextView) viewStubCompat.ˋ();
                    }
                }
            }
            if (this.ॱॱ != null) {
                boolean z;
                ॱᐝ();
                this.ॱॱ.ˊ();
                Context context = this.ॱॱ.getContext();
                ActionBarContextView actionBarContextView = this.ॱॱ;
                if (this.ʻ == null) {
                    z = true;
                } else {
                    z = false;
                }
                aw ayVar = new ay(context, actionBarContextView, cVar, z);
                if (cVar.ˋ(ayVar, ayVar.ˏ())) {
                    ayVar.ˎ();
                    this.ॱॱ.ˊ(ayVar);
                    this.ᐝ = ayVar;
                    if (ॱˊ()) {
                        this.ॱॱ.setAlpha(0.0f);
                        this.ͺ = ViewCompat.ˏॱ(this.ॱॱ).ˏ(1.0f);
                        this.ͺ.ॱ(new id(this) {
                            final /* synthetic */ AppCompatDelegateImpl ˊ;

                            {
                                this.ˊ = r1;
                            }

                            public void ˏ(View view) {
                                this.ˊ.ॱॱ.setVisibility(0);
                                this.ˊ.ॱॱ.sendAccessibilityEvent(32);
                                if (this.ˊ.ॱॱ.getParent() instanceof View) {
                                    ViewCompat.ᐝॱ((View) this.ˊ.ॱॱ.getParent());
                                }
                            }

                            public void ˎ(View view) {
                                this.ˊ.ॱॱ.setAlpha(1.0f);
                                this.ˊ.ͺ.ॱ(null);
                                this.ˊ.ͺ = null;
                            }
                        });
                    } else {
                        this.ॱॱ.setAlpha(1.0f);
                        this.ॱॱ.setVisibility(0);
                        this.ॱॱ.sendAccessibilityEvent(32);
                        if (this.ॱॱ.getParent() instanceof View) {
                            ViewCompat.ᐝॱ((View) this.ॱॱ.getParent());
                        }
                    }
                    if (this.ʻ != null) {
                        this.ˋ.getDecorView().post(this.ˋॱ);
                    }
                } else {
                    this.ᐝ = null;
                }
            }
        }
        if (!(this.ᐝ == null || this.ॱ == null)) {
            this.ॱ.ˋ(this.ᐝ);
        }
        return this.ᐝ;
    }

    final boolean ॱˊ() {
        return this.ˉ && this.ˊᐝ != null && ViewCompat.ˊᐝ(this.ˊᐝ);
    }

    public boolean ʻॱ() {
        return this.ˊˋ;
    }

    void ॱᐝ() {
        if (this.ͺ != null) {
            this.ͺ.ˏ();
        }
    }

    boolean ॱˎ() {
        if (this.ᐝ != null) {
            this.ᐝ.ॱ();
            return true;
        }
        ActionBar ˏ = ˏ();
        if (ˏ == null || !ˏ.ᐝ()) {
            return false;
        }
        return true;
    }

    boolean ˎ(int i, KeyEvent keyEvent) {
        ActionBar ˏ = ˏ();
        if (ˏ != null && ˏ.ˊ(i, keyEvent)) {
            return true;
        }
        if (this.ˏˎ == null || !ˎ(this.ˏˎ, keyEvent.getKeyCode(), keyEvent, 1)) {
            if (this.ˏˎ == null) {
                PanelFeatureState ˊ = ˊ(0, true);
                ˋ(ˊ, keyEvent);
                boolean ˎ = ˎ(ˊ, keyEvent.getKeyCode(), keyEvent, 1);
                ˊ.ॱˊ = false;
                if (ˎ) {
                    return true;
                }
            }
            return false;
        } else if (this.ˏˎ == null) {
            return true;
        } else {
            this.ˏˎ.ˊॱ = true;
            return true;
        }
    }

    boolean ˊ(KeyEvent keyEvent) {
        boolean z = true;
        if ((this.ˎ instanceof o.hh.c) || (this.ˎ instanceof ag)) {
            View decorView = this.ˋ.getDecorView();
            if (decorView != null && hh.ˊ(decorView, keyEvent)) {
                return true;
            }
        }
        if (keyEvent.getKeyCode() == 82 && this.ˎ.dispatchKeyEvent(keyEvent)) {
            return true;
        }
        int keyCode = keyEvent.getKeyCode();
        if (keyEvent.getAction() != 0) {
            z = false;
        }
        return z ? ˋ(keyCode, keyEvent) : ॱ(keyCode, keyEvent);
    }

    boolean ॱ(int i, KeyEvent keyEvent) {
        switch (i) {
            case 4:
                boolean z = this.ˎˏ;
                this.ˎˏ = false;
                PanelFeatureState ˊ = ˊ(0, false);
                if (ˊ == null || !ˊ.ͺ) {
                    if (ॱˎ()) {
                        return true;
                    }
                } else if (z) {
                    return true;
                } else {
                    ˊ(ˊ, true);
                    return true;
                }
                break;
            case g.ॱˑ /*82*/:
                ˏ(0, keyEvent);
                return true;
        }
        return false;
    }

    boolean ˋ(int i, KeyEvent keyEvent) {
        boolean z = true;
        switch (i) {
            case 4:
                if ((keyEvent.getFlags() & DnsConfig.MAX_CACHE_ENTRIES) == 0) {
                    z = false;
                }
                this.ˎˏ = z;
                break;
            case g.ॱˑ /*82*/:
                ˊ(0, keyEvent);
                return true;
        }
        return false;
    }

    public View ˏ(View view, String str, @NonNull Context context, @NonNull AttributeSet attributeSet) {
        boolean z;
        if (this.ᐝᐝ == null) {
            String string = this.ˏ.obtainStyledAttributes(g.ˑॱ).getString(g.ॱˍ);
            if (string == null || AppCompatViewInflater.class.getName().equals(string)) {
                this.ᐝᐝ = new AppCompatViewInflater();
            } else {
                try {
                    this.ᐝᐝ = (AppCompatViewInflater) Class.forName(string).getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
                } catch (Throwable th) {
                    Log.i("AppCompatDelegate", "Failed to instantiate custom view inflater " + string + ". Falling back to default.", th);
                    this.ᐝᐝ = new AppCompatViewInflater();
                }
            }
        }
        if (ʿ) {
            boolean ˏ;
            if (!(attributeSet instanceof XmlPullParser)) {
                ˏ = ˏ((ViewParent) view);
            } else if (((XmlPullParser) attributeSet).getDepth() > 1) {
                ˏ = true;
            } else {
                ˏ = false;
            }
            z = ˏ;
        } else {
            z = false;
        }
        return this.ᐝᐝ.ॱ(view, str, context, attributeSet, z, ʿ, true, dd.ˋ());
    }

    private boolean ˏ(ViewParent viewParent) {
        if (viewParent == null) {
            return false;
        }
        ViewParent decorView = this.ˋ.getDecorView();
        ViewParent viewParent2 = viewParent;
        while (viewParent2 != null) {
            if (viewParent2 == decorView || !(viewParent2 instanceof View) || ViewCompat.ˋˊ((View) viewParent2)) {
                return false;
            }
            viewParent2 = viewParent2.getParent();
        }
        return true;
    }

    public void ʼ() {
        LayoutInflater from = LayoutInflater.from(this.ˏ);
        if (from.getFactory() == null) {
            LayoutInflaterCompatHC.setLayoutInfaltorFactory2(from, this);
        } else if (!(from.getFactory2() instanceof AppCompatDelegateImpl)) {
            Log.i("AppCompatDelegate", "The Activity's LayoutInflater already has a Factory installed so we can not install AppCompat's");
        }
    }

    public final View onCreateView(View view, String str, Context context, AttributeSet attributeSet) {
        return ˏ(view, str, context, attributeSet);
    }

    public View onCreateView(String str, Context context, AttributeSet attributeSet) {
        return onCreateView(null, str, context, attributeSet);
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private void ˎ(androidx.appcompat.app.AppCompatDelegateImpl.PanelFeatureState r11, android.view.KeyEvent r12) {
        /*
        r10 = this;
        r3 = 0;
        r1 = -1;
        r9 = 1;
        r2 = -2;
        r0 = r11.ͺ;
        if (r0 != 0) goto L_0x000c;
    L_0x0008:
        r0 = r10.ॱᐝ;
        if (r0 == 0) goto L_0x000d;
    L_0x000c:
        return;
    L_0x000d:
        r0 = r11.ˏ;
        if (r0 != 0) goto L_0x0025;
    L_0x0011:
        r0 = r10.ˏ;
        r0 = r0.getResources();
        r0 = r0.getConfiguration();
        r0 = r0.screenLayout;
        r0 = r0 & 15;
        r4 = 4;
        if (r0 != r4) goto L_0x0039;
    L_0x0022:
        r0 = r9;
    L_0x0023:
        if (r0 != 0) goto L_0x000c;
    L_0x0025:
        r0 = r10.ˊॱ();
        if (r0 == 0) goto L_0x003b;
    L_0x002b:
        r4 = r11.ˏ;
        r5 = r11.ʽ;
        r0 = r0.onMenuOpened(r4, r5);
        if (r0 != 0) goto L_0x003b;
    L_0x0035:
        r10.ˊ(r11, r9);
        goto L_0x000c;
    L_0x0039:
        r0 = r3;
        goto L_0x0023;
    L_0x003b:
        r0 = r10.ˏ;
        r4 = "window";
        r0 = r0.getSystemService(r4);
        r8 = r0;
        r8 = (android.view.WindowManager) r8;
        if (r8 == 0) goto L_0x000c;
    L_0x0048:
        r0 = r10.ˋ(r11, r12);
        if (r0 == 0) goto L_0x000c;
    L_0x004e:
        r0 = r11.ॱॱ;
        if (r0 == 0) goto L_0x0056;
    L_0x0052:
        r0 = r11.ॱˋ;
        if (r0 == 0) goto L_0x00e0;
    L_0x0056:
        r0 = r11.ॱॱ;
        if (r0 != 0) goto L_0x00ce;
    L_0x005a:
        r0 = r10.ˊ(r11);
        if (r0 == 0) goto L_0x000c;
    L_0x0060:
        r0 = r11.ॱॱ;
        if (r0 == 0) goto L_0x000c;
    L_0x0064:
        r0 = r10.ॱ(r11);
        if (r0 == 0) goto L_0x000c;
    L_0x006a:
        r0 = r11.ˎ();
        if (r0 == 0) goto L_0x000c;
    L_0x0070:
        r0 = r11.ʻ;
        r0 = r0.getLayoutParams();
        if (r0 != 0) goto L_0x00f2;
    L_0x0078:
        r0 = new android.view.ViewGroup$LayoutParams;
        r0.<init>(r2, r2);
        r1 = r0;
    L_0x007e:
        r0 = r11.ˎ;
        r4 = r11.ॱॱ;
        r4.setBackgroundResource(r0);
        r0 = r11.ʻ;
        r0 = r0.getParent();
        if (r0 == 0) goto L_0x0098;
    L_0x008d:
        r4 = r0 instanceof android.view.ViewGroup;
        if (r4 == 0) goto L_0x0098;
    L_0x0091:
        r0 = (android.view.ViewGroup) r0;
        r4 = r11.ʻ;
        r0.removeView(r4);
    L_0x0098:
        r0 = r11.ॱॱ;
        r4 = r11.ʻ;
        r0.addView(r4, r1);
        r0 = r11.ʻ;
        r0 = r0.hasFocus();
        if (r0 != 0) goto L_0x00ac;
    L_0x00a7:
        r0 = r11.ʻ;
        r0.requestFocus();
    L_0x00ac:
        r1 = r2;
    L_0x00ad:
        r11.ˊॱ = r3;
        r0 = new android.view.WindowManager$LayoutParams;
        r3 = r11.ॱ;
        r4 = r11.ˋ;
        r5 = 1002; // 0x3ea float:1.404E-42 double:4.95E-321;
        r6 = 8519680; // 0x820000 float:1.1938615E-38 double:4.209281E-317;
        r7 = -3;
        r0.<init>(r1, r2, r3, r4, r5, r6, r7);
        r1 = r11.ˊ;
        r0.gravity = r1;
        r1 = r11.ᐝ;
        r0.windowAnimations = r1;
        r1 = r11.ॱॱ;
        r8.addView(r1, r0);
        r11.ͺ = r9;
        goto L_0x000c;
    L_0x00ce:
        r0 = r11.ॱˋ;
        if (r0 == 0) goto L_0x0064;
    L_0x00d2:
        r0 = r11.ॱॱ;
        r0 = r0.getChildCount();
        if (r0 <= 0) goto L_0x0064;
    L_0x00da:
        r0 = r11.ॱॱ;
        r0.removeAllViews();
        goto L_0x0064;
    L_0x00e0:
        r0 = r11.ʼ;
        if (r0 == 0) goto L_0x00f0;
    L_0x00e4:
        r0 = r11.ʼ;
        r0 = r0.getLayoutParams();
        if (r0 == 0) goto L_0x00f0;
    L_0x00ec:
        r0 = r0.width;
        if (r0 == r1) goto L_0x00ad;
    L_0x00f0:
        r1 = r2;
        goto L_0x00ad;
    L_0x00f2:
        r1 = r0;
        goto L_0x007e;
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.app.AppCompatDelegateImpl.ˎ(androidx.appcompat.app.AppCompatDelegateImpl$PanelFeatureState, android.view.KeyEvent):void");
    }

    private boolean ˊ(PanelFeatureState panelFeatureState) {
        panelFeatureState.ˎ(ͺ());
        panelFeatureState.ॱॱ = new b(this, panelFeatureState.ˏॱ);
        panelFeatureState.ˊ = 81;
        return true;
    }

    private void ˋ(bd bdVar, boolean z) {
        if (this.ʽॱ == null || !this.ʽॱ.ʻ() || (ViewConfiguration.get(this.ˏ).hasPermanentMenuKey() && !this.ʽॱ.ॱॱ())) {
            PanelFeatureState ˊ = ˊ(0, true);
            ˊ.ॱˋ = true;
            ˊ(ˊ, false);
            ˎ(ˊ, null);
            return;
        }
        Callback ˊॱ = ˊॱ();
        if (this.ʽॱ.ᐝ() && z) {
            this.ʽॱ.ʽ();
            if (!this.ॱᐝ) {
                ˊॱ.onPanelClosed(108, ˊ(0, true).ʽ);
            }
        } else if (ˊॱ != null && !this.ॱᐝ) {
            if (this.ॱˋ && (this.ᐝॱ & 1) != 0) {
                this.ˋ.getDecorView().removeCallbacks(this.ॱͺ);
                this.ॱͺ.run();
            }
            PanelFeatureState ˊ2 = ˊ(0, true);
            if (ˊ2.ʽ != null && !ˊ2.ॱˎ && ˊॱ.onPreparePanel(0, ˊ2.ʼ, ˊ2.ʽ)) {
                ˊॱ.onMenuOpened(108, ˊ2.ʽ);
                this.ʽॱ.ʼ();
            }
        }
    }

    private boolean ˏ(PanelFeatureState panelFeatureState) {
        Context axVar;
        bd bdVar;
        Context context = this.ˏ;
        if ((panelFeatureState.ˏ == 0 || panelFeatureState.ˏ == 108) && this.ʽॱ != null) {
            TypedValue typedValue = new TypedValue();
            Theme theme = context.getTheme();
            theme.resolveAttribute(o.ah.c.ॱॱ, typedValue, true);
            Theme theme2 = null;
            if (typedValue.resourceId != 0) {
                theme2 = context.getResources().newTheme();
                theme2.setTo(theme);
                theme2.applyStyle(typedValue.resourceId, true);
                theme2.resolveAttribute(o.ah.c.ᐝ, typedValue, true);
            } else {
                theme.resolveAttribute(o.ah.c.ᐝ, typedValue, true);
            }
            if (typedValue.resourceId != 0) {
                if (theme2 == null) {
                    theme2 = context.getResources().newTheme();
                    theme2.setTo(theme);
                }
                theme2.applyStyle(typedValue.resourceId, true);
            }
            Theme theme3 = theme2;
            if (theme3 != null) {
                axVar = new ax(context, 0);
                axVar.getTheme().setTo(theme3);
                bdVar = new bd(axVar);
                bdVar.ॱ((o.bd.e) this);
                panelFeatureState.ॱ(bdVar);
                return true;
            }
        }
        axVar = context;
        bdVar = new bd(axVar);
        bdVar.ॱ((o.bd.e) this);
        panelFeatureState.ॱ(bdVar);
        return true;
    }

    private boolean ॱ(PanelFeatureState panelFeatureState) {
        if (panelFeatureState.ʼ != null) {
            panelFeatureState.ʻ = panelFeatureState.ʼ;
            return true;
        } else if (panelFeatureState.ʽ == null) {
            return false;
        } else {
            if (this.ˊˊ == null) {
                this.ˊˊ = new j(this);
            }
            panelFeatureState.ʻ = (View) panelFeatureState.ˏ(this.ˊˊ);
            return panelFeatureState.ʻ != null;
        }
    }

    private boolean ˋ(PanelFeatureState panelFeatureState, KeyEvent keyEvent) {
        if (this.ॱᐝ) {
            return false;
        }
        if (panelFeatureState.ॱˊ) {
            return true;
        }
        if (!(this.ˏˎ == null || this.ˏˎ == panelFeatureState)) {
            ˊ(this.ˏˎ, false);
        }
        Callback ˊॱ = ˊॱ();
        if (ˊॱ != null) {
            panelFeatureState.ʼ = ˊॱ.onCreatePanelView(panelFeatureState.ˏ);
        }
        boolean z = panelFeatureState.ˏ == 0 || panelFeatureState.ˏ == 108;
        if (z && this.ʽॱ != null) {
            this.ʽॱ.setMenuPrepared();
        }
        if (panelFeatureState.ʼ == null && !(z && (ˋॱ() instanceof am))) {
            if (panelFeatureState.ʽ == null || panelFeatureState.ॱˎ) {
                if (panelFeatureState.ʽ == null && (!ˏ(panelFeatureState) || panelFeatureState.ʽ == null)) {
                    return false;
                }
                if (z && this.ʽॱ != null) {
                    if (this.ˋˊ == null) {
                        this.ˋˊ = new d(this);
                    }
                    this.ʽॱ.setMenu(panelFeatureState.ʽ, this.ˋˊ);
                }
                panelFeatureState.ʽ.ॱॱ();
                if (ˊॱ.onCreatePanelMenu(panelFeatureState.ˏ, panelFeatureState.ʽ)) {
                    panelFeatureState.ॱˎ = false;
                } else {
                    panelFeatureState.ॱ(null);
                    if (!z || this.ʽॱ == null) {
                        return false;
                    }
                    this.ʽॱ.setMenu(null, this.ˋˊ);
                    return false;
                }
            }
            panelFeatureState.ʽ.ॱॱ();
            if (panelFeatureState.ॱᐝ != null) {
                panelFeatureState.ʽ.ˊ(panelFeatureState.ॱᐝ);
                panelFeatureState.ॱᐝ = null;
            }
            if (ˊॱ.onPreparePanel(0, panelFeatureState.ʼ, panelFeatureState.ʽ)) {
                if (KeyCharacterMap.load(keyEvent != null ? keyEvent.getDeviceId() : -1).getKeyboardType() != 1) {
                    z = true;
                } else {
                    z = false;
                }
                panelFeatureState.ʻॱ = z;
                panelFeatureState.ʽ.setQwertyMode(panelFeatureState.ʻॱ);
                panelFeatureState.ʽ.ʼ();
            } else {
                if (z && this.ʽॱ != null) {
                    this.ʽॱ.setMenu(null, this.ˋˊ);
                }
                panelFeatureState.ʽ.ʼ();
                return false;
            }
        }
        panelFeatureState.ॱˊ = true;
        panelFeatureState.ˊॱ = false;
        this.ˏˎ = panelFeatureState;
        return true;
    }

    void ˊ(bd bdVar) {
        if (!this.ˋˋ) {
            this.ˋˋ = true;
            this.ʽॱ.ॱˊ();
            Callback ˊॱ = ˊॱ();
            if (!(ˊॱ == null || this.ॱᐝ)) {
                ˊॱ.onPanelClosed(108, bdVar);
            }
            this.ˋˋ = false;
        }
    }

    void ʼ(int i) {
        ˊ(ˊ(i, true), true);
    }

    void ˊ(PanelFeatureState panelFeatureState, boolean z) {
        if (z && panelFeatureState.ˏ == 0 && this.ʽॱ != null && this.ʽॱ.ᐝ()) {
            ˊ(panelFeatureState.ʽ);
            return;
        }
        WindowManager windowManager = (WindowManager) this.ˏ.getSystemService("window");
        if (!(windowManager == null || !panelFeatureState.ͺ || panelFeatureState.ॱॱ == null)) {
            windowManager.removeView(panelFeatureState.ॱॱ);
            if (z) {
                ˋ(panelFeatureState.ˏ, panelFeatureState, null);
            }
        }
        panelFeatureState.ॱˊ = false;
        panelFeatureState.ˊॱ = false;
        panelFeatureState.ͺ = false;
        panelFeatureState.ʻ = null;
        panelFeatureState.ॱˋ = true;
        if (this.ˏˎ == panelFeatureState) {
            this.ˏˎ = null;
        }
    }

    private boolean ˊ(int i, KeyEvent keyEvent) {
        if (keyEvent.getRepeatCount() == 0) {
            PanelFeatureState ˊ = ˊ(i, true);
            if (!ˊ.ͺ) {
                return ˋ(ˊ, keyEvent);
            }
        }
        return false;
    }

    private boolean ˏ(int i, KeyEvent keyEvent) {
        boolean z = true;
        if (this.ᐝ != null) {
            return false;
        }
        PanelFeatureState ˊ = ˊ(i, true);
        if (i != 0 || this.ʽॱ == null || !this.ʽॱ.ʻ() || ViewConfiguration.get(this.ˏ).hasPermanentMenuKey()) {
            boolean z2;
            if (ˊ.ͺ || ˊ.ˊॱ) {
                z2 = ˊ.ͺ;
                ˊ(ˊ, true);
                z = z2;
            } else {
                if (ˊ.ॱˊ) {
                    if (ˊ.ॱˎ) {
                        ˊ.ॱˊ = false;
                        z2 = ˋ(ˊ, keyEvent);
                    } else {
                        z2 = true;
                    }
                    if (z2) {
                        ˎ(ˊ, keyEvent);
                    }
                }
                z = false;
            }
        } else if (this.ʽॱ.ᐝ()) {
            z = this.ʽॱ.ʽ();
        } else {
            if (!this.ॱᐝ && ˋ(ˊ, keyEvent)) {
                z = this.ʽॱ.ʼ();
            }
            z = false;
        }
        if (z) {
            AudioManager audioManager = (AudioManager) this.ˏ.getSystemService("audio");
            if (audioManager != null) {
                audioManager.playSoundEffect(0);
            } else {
                Log.w("AppCompatDelegate", "Couldn't get audio manager");
            }
        }
        return z;
    }

    void ˋ(int i, PanelFeatureState panelFeatureState, Menu menu) {
        if (menu == null) {
            if (panelFeatureState == null && i >= 0 && i < this.ˑ.length) {
                panelFeatureState = this.ˑ[i];
            }
            if (panelFeatureState != null) {
                menu = panelFeatureState.ʽ;
            }
        }
        if ((panelFeatureState == null || panelFeatureState.ͺ) && !this.ॱᐝ) {
            this.ˎ.onPanelClosed(i, menu);
        }
    }

    PanelFeatureState ˏ(Menu menu) {
        PanelFeatureState[] panelFeatureStateArr = this.ˑ;
        int length = panelFeatureStateArr != null ? panelFeatureStateArr.length : 0;
        for (int i = 0; i < length; i++) {
            PanelFeatureState panelFeatureState = panelFeatureStateArr[i];
            if (panelFeatureState != null && panelFeatureState.ʽ == menu) {
                return panelFeatureState;
            }
        }
        return null;
    }

    protected PanelFeatureState ˊ(int i, boolean z) {
        Object obj = this.ˑ;
        if (obj == null || obj.length <= i) {
            Object obj2 = new PanelFeatureState[(i + 1)];
            if (obj != null) {
                System.arraycopy(obj, 0, obj2, 0, obj.length);
            }
            this.ˑ = obj2;
            obj = obj2;
        }
        PanelFeatureState panelFeatureState = obj[i];
        if (panelFeatureState != null) {
            return panelFeatureState;
        }
        panelFeatureState = new PanelFeatureState(i);
        obj[i] = panelFeatureState;
        return panelFeatureState;
    }

    private boolean ˎ(PanelFeatureState panelFeatureState, int i, KeyEvent keyEvent, int i2) {
        boolean z = false;
        if (!keyEvent.isSystem()) {
            if ((panelFeatureState.ॱˊ || ˋ(panelFeatureState, keyEvent)) && panelFeatureState.ʽ != null) {
                z = panelFeatureState.ʽ.performShortcut(i, keyEvent, i2);
            }
            if (z && (i2 & 1) == 0 && this.ʽॱ == null) {
                ˊ(panelFeatureState, true);
            }
        }
        return z;
    }

    private void ʻ(int i) {
        this.ᐝॱ |= 1 << i;
        if (!this.ॱˋ) {
            ViewCompat.ˏ(this.ˋ.getDecorView(), this.ॱͺ);
            this.ॱˋ = true;
        }
    }

    void ʽ(int i) {
        PanelFeatureState ˊ = ˊ(i, true);
        if (ˊ.ʽ != null) {
            Bundle bundle = new Bundle();
            ˊ.ʽ.ˎ(bundle);
            if (bundle.size() > 0) {
                ˊ.ॱᐝ = bundle;
            }
            ˊ.ʽ.ॱॱ();
            ˊ.ʽ.clear();
        }
        ˊ.ॱˎ = true;
        ˊ.ॱˋ = true;
        if ((i == 108 || i == 0) && this.ʽॱ != null) {
            ˊ = ˊ(0, false);
            if (ˊ != null) {
                ˊ.ॱˊ = false;
                ˋ(ˊ, null);
            }
        }
    }

    int ॱॱ(int i) {
        int i2;
        int i3 = 1;
        int i4 = 0;
        if (this.ॱॱ == null || !(this.ॱॱ.getLayoutParams() instanceof MarginLayoutParams)) {
            i2 = 0;
        } else {
            int i5;
            MarginLayoutParams marginLayoutParams = (MarginLayoutParams) this.ॱॱ.getLayoutParams();
            if (this.ॱॱ.isShown()) {
                if (this.ॱʻ == null) {
                    this.ॱʻ = new Rect();
                    this.ـ = new Rect();
                }
                Rect rect = this.ॱʻ;
                Rect rect2 = this.ـ;
                rect.set(0, i, 0, 0);
                de.ˋ(this.ˊᐝ, rect, rect2);
                if (marginLayoutParams.topMargin != (rect2.top == 0 ? i : 0)) {
                    marginLayoutParams.topMargin = i;
                    if (this.ˎˎ == null) {
                        this.ˎˎ = new View(this.ˏ);
                        this.ˎˎ.setBackgroundColor(this.ˏ.getResources().getColor(o.ah.a.ˊ));
                        this.ˊᐝ.addView(this.ˎˎ, -1, new LayoutParams(-1, i));
                        i5 = 1;
                    } else {
                        LayoutParams layoutParams = this.ˎˎ.getLayoutParams();
                        if (layoutParams.height != i) {
                            layoutParams.height = i;
                            this.ˎˎ.setLayoutParams(layoutParams);
                        }
                        i5 = 1;
                    }
                } else {
                    i5 = 0;
                }
                if (this.ˎˎ == null) {
                    i3 = 0;
                }
                if (!(this.ॱˊ || i3 == 0)) {
                    i = 0;
                }
                int i6 = i5;
                i5 = i3;
                i3 = i6;
            } else if (marginLayoutParams.topMargin != 0) {
                marginLayoutParams.topMargin = 0;
                i5 = 0;
            } else {
                i3 = 0;
                i5 = 0;
            }
            if (i3 != 0) {
                this.ॱॱ.setLayoutParams(marginLayoutParams);
            }
            i2 = i5;
        }
        if (this.ˎˎ != null) {
            View view = this.ˎˎ;
            if (i2 == 0) {
                i4 = 8;
            }
            view.setVisibility(i4);
        }
        return i;
    }

    private void ʼॱ() {
        if (this.ˉ) {
            throw new AndroidRuntimeException("Window feature must be requested before adding content");
        }
    }

    private int ˋॱ(int i) {
        if (i == 8) {
            Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR id when requesting this feature.");
            return 108;
        } else if (i != 9) {
            return i;
        } else {
            Log.i("AppCompatDelegate", "You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY id when requesting this feature.");
            return 109;
        }
    }

    void ॱˋ() {
        if (this.ʽॱ != null) {
            this.ʽॱ.ॱˊ();
        }
        if (this.ʻ != null) {
            this.ˋ.getDecorView().removeCallbacks(this.ˋॱ);
            if (this.ʻ.isShowing()) {
                try {
                    this.ʻ.dismiss();
                } catch (IllegalArgumentException e) {
                }
            }
            this.ʻ = null;
        }
        ॱᐝ();
        PanelFeatureState ˊ = ˊ(0, false);
        if (ˊ != null && ˊ.ʽ != null) {
            ˊ.ʽ.close();
        }
    }

    public boolean ᐝ() {
        boolean z = false;
        int ʿ = ʿ();
        int ᐝ = ᐝ(ʿ);
        if (ᐝ != -1) {
            z = ˏॱ(ᐝ);
        }
        if (ʿ == 0) {
            ˉ();
            this.ॱʼ.ˎ();
        }
        this.ˏˏ = true;
        return z;
    }

    int ᐝ(int i) {
        switch (i) {
            case -100:
                return -1;
            case 0:
                if (VERSION.SDK_INT >= 23 && ((UiModeManager) this.ˏ.getSystemService(UiModeManager.class)).getNightMode() == 0) {
                    return -1;
                }
                ˉ();
                return this.ॱʼ.ˊ();
            default:
                return i;
        }
    }

    private int ʿ() {
        return this.ͺॱ != -100 ? this.ͺॱ : AppCompatDelegate.ʽ();
    }

    private boolean ˏॱ(int i) {
        Resources resources = this.ˏ.getResources();
        Configuration configuration = resources.getConfiguration();
        int i2 = configuration.uiMode & 48;
        int i3 = i == 2 ? 32 : 16;
        if (i2 == i3) {
            return false;
        }
        if (ˊˊ()) {
            ((Activity) this.ˏ).recreate();
        } else {
            Configuration configuration2 = new Configuration(configuration);
            DisplayMetrics displayMetrics = resources.getDisplayMetrics();
            configuration2.uiMode = i3 | (configuration2.uiMode & -49);
            resources.updateConfiguration(configuration2, displayMetrics);
            if (VERSION.SDK_INT < 26) {
                ak.ॱ(resources);
            }
        }
        return true;
    }

    private void ˉ() {
        if (this.ॱʼ == null) {
            this.ॱʼ = new e(this, al.ॱ(this.ˏ));
        }
    }

    private boolean ˊˊ() {
        if (!this.ˏˏ || !(this.ˏ instanceof Activity)) {
            return false;
        }
        try {
            if ((this.ˏ.getPackageManager().getActivityInfo(new ComponentName(this.ˏ, this.ˏ.getClass()), 0).configChanges & WXMediaMessage.TITLE_LENGTH_LIMIT) == 0) {
                return true;
            }
            return false;
        } catch (Throwable e) {
            Log.d("AppCompatDelegate", "Exception while getting ActivityInfo", e);
            return true;
        }
    }
}
